import 'dart:convert';

///登陆模型
class LoginModel {
  LoginModel({
    this.token,
    this.expiryTime,
    this.member,
  });

  String? token;
  String? expiryTime;
  Member? member;

  factory LoginModel.fromRawJson(String str) => LoginModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory LoginModel.fromJson(Map<String, dynamic> json) => LoginModel(
    token: json["token"] == null ? "" : json["token"].toString(),
    expiryTime: json["expiry_time"] == null ? ""  : json["expiry_time"].toString(),
    member: json["member"] == null ? null : Member.fromJson(json["member"]),
  );

  Map<String, dynamic> toJson() => {
    "token": token == null ? "" : token.toString(),
    "expiry_time": expiryTime == null ? "" : expiryTime.toString(),
    "member": member == null ? null : member!.toJson(),
  };
}

class Member {
  Member({
    this.id,
    this.money,
    this.integral,
    this.mobile,
    this.parentId,
    this.parentIds,
    this.password,
    this.memberGroupId,
    this.appinitType,
    this.smsCode,
    this.code,
    this.introduce,
    this.inviteCount,
    this.teamCount,
    this.accountAddress,
    this.receiptImg,
    this.number,
    this.safetyCode,
    this.nonce,
    this.nickname,
    this.portrait,
    this.virtualMoney,
    this.freezeMoney,
    this.exp,
    this.points,
    this.registerIp,
    this.loginIp,
    this.loginTime,
    this.loginNum,
    this.status,
    this.realNameStatus,
    this.buyMuchStatus,
    this.remark,
    this.createTime,
    this.updateTime,
    this.cateId,
    this.castRole,
  });

  String? id;
  String? money;
  String? integral;
  String? mobile;
  String? parentId;
  String? parentIds;
  String? password;
  String? memberGroupId;
  String? appinitType;
  String? smsCode;
  String? code;
  String? introduce;
  String? inviteCount;
  String? teamCount;
  String? accountAddress;
  String? receiptImg;
  String? number;
  String? safetyCode;
  String? nonce;
  String? nickname;
  String? portrait;
  String? virtualMoney;
  String? freezeMoney;
  String? exp;
  String? points;
  String? registerIp;
  String? loginIp;
  String? loginTime;
  String? loginNum;
  String? status;
  String? realNameStatus;
  String? buyMuchStatus;
  String? remark;
  String? createTime;
  String? updateTime;
  String? cateId;
  String? castRole;

  factory Member.fromRawJson(String str) => Member.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory Member.fromJson(Map<String, dynamic> json) => Member(
    id: json["id"] == null ? "" : json["id"].toString(),
    money: json["money"] == null ? "" : json["money"].toString(),
    integral: json["integral"] == null ? "" : json["integral"].toString(),
    mobile: json["mobile"] == null ? "" : json["mobile"].toString(),
    parentId: json["parent_id"] == null ? "" : json["parent_id"].toString(),
    parentIds: json["parent_ids"] == null ? "" : json["parent_ids"].toString(),
    password: json["password"] == null ? "" : json["password"].toString().toString(),
    memberGroupId: json["member_group_id"] == null ? "" : json["member_group_id"].toString(),
    appinitType: json["appinit_type"] == null ? "" : json["appinit_type"].toString(),
    smsCode: json["sms_code"] == null ? "" : json["sms_code"].toString(),
    code: json["code"] == null ? "" : json["code"].toString(),
    introduce: json["introduce"] == null ? "" : json["introduce"].toString(),
    inviteCount: json["invite_count"] == null ? "" : json["invite_count"].toString(),
    teamCount: json["team_count"] == null ? "" : json["team_count"].toString(),
    accountAddress: json["account_address"] == null ? "" : json["account_address"].toString(),
    receiptImg: json["receipt_img"] == null ? "" : json["receipt_img"].toString(),
    number: json["number"] == null ? "" : json["number"].toString(),
    safetyCode: json["safety_code"] == null ? "" : json["safety_code"].toString(),
    nonce: json["nonce"] == null ? "" : json["nonce"].toString(),
    nickname: json["nickname"] == null ? "" : json["nickname"].toString(),
    portrait: json["portrait"] == null ? "" : json["portrait"].toString(),
    virtualMoney: json["virtual_money"] == null ? "" : json["virtual_money"].toString(),
    freezeMoney: json["freeze_money"] == null ? "" : json["freeze_money"].toString(),
    exp: json["exp"] == null ? "" : json["exp"].toString(),
    points: json["points"] == null ? "" : json["points"].toString(),
    registerIp: json["register_ip"] == null ? "" : json["register_ip"].toString(),
    loginIp: json["login_ip"] == null ? "" : json["login_ip"].toString(),
    loginTime: json["login_time"] == null ? "" : json["login_time"].toString(),
    loginNum: json["login_num"] == null ? "" : json["login_num"].toString(),
    status: json["status"] == null ? "" : json["status"].toString(),
    realNameStatus: json["real_name_status"] == null ? "" : json["real_name_status"].toString(),
    buyMuchStatus: json["buy_much_status"] == null ? "" : json["buy_much_status"].toString(),
    remark: json["remark"] == null ? "" : json["remark"].toString(),
    createTime: json["create_time"] == null ? "" : json["create_time"].toString(),
    updateTime: json["update_time"] == null ? "" : json["update_time"].toString(),
    cateId: json["cate_id"] == null ? "" : json["cate_id"].toString(),
    castRole: json["cast_role"] == null ? "" : json["cast_role"].toString(),

  );

  Map<String, dynamic> toJson() => {
    "id": id == null ? "" : id,
    "money": money == null ? "" : money,
    "integral": integral == null ? "" : integral,
    "mobile": mobile == null ? "" : mobile,
    "parent_id": parentId == null ? "" : parentId,
    "parent_ids": parentIds == null ? "" : parentIds,
    "password": password == null ? "" : password,
    "member_group_id": memberGroupId == null ? "" : memberGroupId,
    "appinit_type": appinitType == null ? "" : appinitType,
    "sms_code": smsCode == null ? "" : smsCode,
    "code": code == null ? "" : code,
    "introduce": introduce == null ? "" : introduce,
    "invite_count": inviteCount == null ? "" : inviteCount,
    "team_count": teamCount == null ? "" : teamCount,
    "account_address": accountAddress == null ? "" : accountAddress,
    "receipt_img": receiptImg == null ? "" : receiptImg,
    "number": number == null ? "" : number,
    "safety_code": safetyCode == null ? "" : safetyCode,
    "nonce": nonce == null ? "" : nonce,
    "nickname": nickname == null ? "" : nickname,
    "portrait": portrait == null ? "" : portrait,
    "virtual_money": virtualMoney == null ? "" : virtualMoney,
    "freeze_money": freezeMoney == null ? "" : freezeMoney,
    "exp": exp == null ? "" : exp,
    "points": points == null ? "" : points,
    "register_ip": registerIp == null ? "" : registerIp,
    "login_ip": loginIp == null ? "" : loginIp,
    "login_time": loginTime == null ? "" : loginTime,
    "login_num": loginNum == null ? "" : loginNum,
    "status": status == null ? "" : status,
    "real_name_status":realNameStatus == null ? "" : realNameStatus,
    "buy_much_status":buyMuchStatus == null ? "" : buyMuchStatus,
    "remark": remark == null ? "" : remark,
    "create_time": createTime == null ? "" : createTime,
    "update_time": updateTime == null ? "" : updateTime,
    "cate_id": cateId == null ? "" : cateId,
    "cast_role": castRole == null ? "0" : castRole,
  };
}


